Add I2c BH1750 light sensor for Raspberry Pi#8050
Merged
Merged
Conversation
pvizeli
requested changes
Jun 15, 2017
Member
pvizeli
left a comment
There was a problem hiding this comment.
Amazing work but it is not allow to have proto specific code inside HomeAssistant. Please export this device specific code into a new mini library and use this for this sensor.
4 tasks
Member
Author
|
@pvizeli, changes are done |
* new sensor platform * requirements_all and .coveragerc update
ed4358b to
39ecb16
Compare
pvizeli
approved these changes
Jun 22, 2017
Merged
dethpickle
pushed a commit
to dethpickle/home-assistant
that referenced
this pull request
Aug 18, 2017
* new sensor platform * requirements_all and .coveragerc update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduction:
Many of us use a Raspberry Pi to run Home Assistant, and we have different sensors connected to it, but for many of them there is no direct support, and it is necessary to use template sensors or command line sensors to make them work within Home Assistant.
Problem is using shell commands to retrieve the values of some sensors limits the working modes of these sensors, and, IMHO, it could be an entry barrier for some beginners.
I think that, as it exists for sensors like the DHT11/22 or the onewire ones, specific platforms for good and cheap digital sensors, with a simple configuration in Home Assistant, are very convenient.
This is the third of a series of PR that I intend to propose for supporting I2c digital sensors compatible with Raspberry Pi. First was #7989 (BME280 sensor), second was #8049 (HTU21D sensor), and this is the last (I don't have any more sensors to implement).
Description:
BH1750 sensor support as a sensor platform, with multiple working modes as described in its data sheet.
Senses the light level in lux.
The docs include a section to easy install the
i2candsmbussupport for thehome_assistantuser, to get things done quickly.Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2821
Example entry for
configuration.yaml(if applicable):A more complex, and customised configuration could be:
Example of customized configuration.yaml entry
sensor:
name: Light level
i2c_address: 0x5c
operation_mode: continuous_high_res_mode_2
measurement_delay_ms: 30
scan_interval: 10
Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.